<?php
$errors = array();
if ($_POST) {
	// run the validation script
	require_once('library.php');
	try {
		// Validate dbName (Catalog Name) name not empty
		$val = new Zend_Validate_NotEmpty(Zend_Validate_NotEmpty::STRING);
		if(!$val->isValid($_POST['dbName'])){
			$errors['dbName']='*** Required field -> ';
		}
		
		if(!$errors){
			$data = array('dbName' => $_POST['dbName'],
			              'dbDescription' => $_POST['dbDescription'],
						  'accountId' => $_SESSION['accountId']);
			$dbWrite->insert('databases', $data);
			header('Location: DBList.php');			  
		}
	} catch (Exception $e){
		echo $e->getMessage();
	}
}